﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Uc_LogIn.ascx.cs" Inherits="Uc_LogIn" %>
    <table style="border-style:solid"  align="center" >
    <tr ><td  style="border-style:solid"  colspan="2"  align="center">
        <asp:Label ID="Label3" runat="server" Text="登入到我的系統"></asp:Label></td></tr>
    <tr><td style="border-style:solid">
        <asp:Label ID="Label1" runat="server" Text="帳號"></asp:Label></td><td style="border-style:solid">
            <asp:TextBox ID="txt_UserName" runat="server"></asp:TextBox>
        </td></tr>
    <tr><td style="border-style:solid"><asp:Label ID="Label2" runat="server" Text="密碼"></asp:Label></td><td style="border-style:solid">
        <asp:TextBox ID="txt_Password" runat="server" TextMode="Password"></asp:TextBox>
        </td></tr>
            <tr><td style="border-style:solid"><asp:Label ID="Label4" runat="server" Text="確認密碼"></asp:Label></td><td style="border-style:solid">
        <asp:TextBox ID="txt_AgainPassword" runat="server" TextMode="Password" ></asp:TextBox>
        </td></tr>
    <tr><td style="border-style:solid" align="center" colspan="2">
        <asp:Button ID="btn_LogIn" runat="server" Text="登入" 
        OnClientClick="Bool=Not_Null(); return Bool ;Bol=Check_Password();return Bol"  />
         <%--OnClientClick="; return Bool ;Bol=Check_Password();return Bol"  />--%>
        <asp:Button ID="btn_Clear" runat="server" Text="重填"  OnClientClick="ClearAll()"/>
        <asp:Button ID="btn_GetPassword" runat="server" Text="忘記密碼"  
            OnClientClick="if (confirm('是否要取回密碼?'))GetPassword();"
                />
        </td></tr>
    </table>
<script  type="text/javascript">
    //        function Show() {
    //            var LogIn = document.getElementById("txt_UserName");
    //            var Password = document.getElementById("txt_Password");

    //            if (LogIn.value != null) {
    //                alert(LogIn.value);
    //            }

    //        }

    function ClearAll() {
        var txt_UserName = document.getElementById("Uc_LogIn1_txt_UserName");
        var txt_Password = document.getElementById("Uc_LogIn1_txt_Password");
        var txt_AgainPassword = document.getElementById("Uc_LogIn1_txt_AgainPassword");
        var ar = new Array(2);
        ar[0] = txt_UserName;
        ar[1] = txt_Password;
        for (var s = 0; s < ar.length; s++) {
            ar[s].value = "";
        }

    }
    var Bol = true;
    function Check_Password() {
        var txt_Password = document.getElementById("Uc_LogIn1_txt_Password");
        var txt_AgainPassword = document.getElementById("Uc_LogIn1_txt_AgainPassword");
        if (txt_Password.value != txt_AgainPassword.value) {
            alert("確認密碼有誤");
            return Bol = false;
        }
    }
    var Bool = true;
    function Not_Null() {
        var txt_UserName = document.getElementById("Uc_LogIn1_txt_UserName");
        var txt_Passwrod = document.getElementById("Uc_LogIn1_txt_Password");
        var txt_AgainPassword = document.getElementById("Uc_LogIn1_txt_AgainPassword");
        var ar = new Array(2);
        ar[0] = txt_UserName;
        ar[1] = txt_Passwrod;
        ar[2] = txt_AgainPassword;
        for (var i = 0; i < ar.length; i++) {
            if (ar[i].value == "") {
                alert(ar[i].id + "\t" + "未填值");
                return Bool = false;
            }

        }
    }
    function GetPassword() {
        document.location = "../GetPassword.aspx";
        alert('abc');
    }
         </script>
